/**数据库 */
const mongoose = require('mongoose')
mongoose.connect('mongodb://127.0.0.1:27017/backend', (err) => {
  if (err === null) {
    console.log('mongodb数据库连接成功！')
  }
})
const GoodsSchema = mongoose.Schema({
  name: {
    type: String,
    minlength: 2
  },
  price: {
    type: Number,
    min: 0.0,
    default: 0.0
  },
  num: {
    type: Number,
    min: 0,
    default: 0
  }
})
const userModel = mongoose.model('Goods', GoodsSchema, 'goods')
module.exports = userModel
/***数据库结束 */
